package com.wf.it.hpuser.dao;

import com.wf.it.common.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface UserDao extends JpaRepository<User,Integer>, JpaSpecificationExecutor<User> {
    User findByLoginName(String loginName);

    @Modifying
    @Query(nativeQuery=true,
            value="update users set user_balance=user_balance+?2 where user_identitycard=?1")
    void updateBalance(String userIdCard, int money);
}
